const API = require('./base')



// 轮播图
const getStickyPosts = function(data) {
	return API.get('/api/v1/news/get_sticky_post', data);
}

// 文章列表
const getPostsList = function(data) {
	return API.get('/api/v1/news/get_news_list', data, { token:true });
}

// 文章详情
const getPostsbyID = function(id){
	let data={
		"newsId":id
	}
	return API.get('/api/v1/news/get_news_detail', data, { token:true });   
}


// 收藏文章
const fav = function(data) {
	return API.post('/api/v1/news/star_news', data, { token: true });
}

// 点赞文章
const like = function(data) {
	return API.post('/api/v1/news/like_news', data, { token: true });
}

// 收藏列表
const getFavPosts = function(data) {
	return API.get('/api/v1/news/get_star_news', data, { token: true });
}

// 浏览记录列表
const getLikePosts = function(data) {
	return API.get('/api/v1/news/get_history_views', data, { token: true });
}


API.getStickyPosts			    	= getStickyPosts
API.getPostsList				    = getPostsList
API.getPostsbyID				    = getPostsbyID
API.fav							    = API.guard(fav)
API.getFavPosts					    = API.guard(getFavPosts)
API.like						    = API.guard(like)
API.getLikePosts				    = API.guard(getLikePosts)

module.exports = API